
#include "TaskQueue.h"
#include "Threadpool.h"
#include "MyTask.h"
#include <memory>
#include <iostream>
using std::endl;
using std::cout;
using std::unique_ptr;
int main(int argc, char *argv[])
{
    //十个任务
/*
 *     TaskQueue taskQue(10);
 *     unique_ptr<Thread> consumer(new ConsumerThread(taskQue));
 *     unique_ptr<ProducerThread> producer(new ProducerThread(taskQue));
 *
 *     consumer->start();
 *     producer->start();
 *     consumer->join();
 *     producer->join();
 *
 */

    Threadpool threadpool(4, 10);
    threadpool.start();
    unique_ptr<Task> task(new MyTask);
    int cnt = 20;
    while(cnt--)
    {
        threadpool.addTask(task.get());
        cout << "add task cnt =  " << cnt << endl;
    }

    threadpool.stop();

    return 0;
}

